package com.abaaba.project2.service.wx.wxserviceimpl;

import com.abaaba.project2.bean.*;
import com.abaaba.project2.bean.bo.wx.WXGoodsAndSearchUseBO;
import com.abaaba.project2.bean.bo.wx.WXSearchSpecificationOfGoodsSpecificationBO;
import com.abaaba.project2.bean.bo.wx.WXSelectByUserIdAndNickNameBO;
import com.abaaba.project2.bean.vo.wx.*;
import com.abaaba.project2.mapper.*;
import com.abaaba.project2.service.wx.WXGoodsShowListService;
import com.abaaba.project2.util.DateToStringUtil;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.System;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class WXGoodsShowListServiceImpl implements WXGoodsShowListService {

    /*info*/
    @Autowired
    GoodsMapper goodsMapper;

    @Autowired
    CategoryMapper categoryMapper;

    //"couponList"
    @Autowired
    CouponMapper couponMapper;
    //"grouponList" 这个是个goods表
    /*@Autowired
    GoodsMapper goodsMapper;*/

    //"banner"
    @Autowired
    AdMapper adMapper;

    //"brand"
    @Autowired
    BrandMapper brandMapper;

    @Autowired
    AdTopicMapper adTopicMapper;

    /*comment*/
    @Autowired
    CommentMapper commentMapper;

    /*"specificationList"*/
    @Autowired
    GoodsSpecificationMapper goodsSpecificationMapper;
    /*团购不用*/

    /*issue*/
    @Autowired
    IssueMapper issueMapper;

    /*attribute*/
    @Autowired
    GoodsAttributeMapper goodsAttributeMapper;

    /*productList*/
    @Autowired
    GoodsProductMapper goodsProductMapper;

    @Autowired
    UserMapper userMapper;

    static Integer i = 1;
    static List<Category> categoryList;
    static Integer staticId = 0;
    static List<GoodsAndCategoryId> goodsAndCategoryIds = new ArrayList<>();
    static List<GoodsAndCategoryId> goodsAndCategoryIdsIsNew = new ArrayList<>();
    static List<GoodsAndCategoryId> goodsAndCategoryIdsIsHot = new ArrayList<>();
    @Override
    public WXGoodsShowListVO wxGoodsShowListService(WXGoodsAndSearchUseBO wxGoodsAndSearchUseBO) {
        //wxGoodsAndSearchUseBO.getBrandId();
        PageHelper.startPage(wxGoodsAndSearchUseBO.getPage(), wxGoodsAndSearchUseBO.getSize());
        //wxGoodsAndSearchUseBO.getOrder()   wxGoodsAndSearchUseBO.getSort() 如果他们两个为空 那就是列表，如果不为空，那就是搜索
        /*逻辑问题改为，如果wxGoodsAndSearchUseBO*/
        //
        GoodsExample goodsExample1 = new GoodsExample();
        GoodsExample goodsExample2 = new GoodsExample();
        GoodsExample goodsExampleIsNew = new GoodsExample();
        GoodsExample goodsExampleIsNew1 = new GoodsExample();
        GoodsExample goodsExampleIsHot = new GoodsExample();
        GoodsExample goodsExampleIsHot1 = new GoodsExample();
        GoodsExample goodsExampleBrand = new GoodsExample();

        goodsExample1.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        goodsExample2.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        goodsExampleIsNew.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        goodsExampleIsNew1.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        goodsExampleIsHot.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        goodsExampleIsHot1.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());
        /*--------------------------------上---------------------------------------*/
        ArrayList<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeans1 = null;
        Long count1 = null;
        List<Category> categoriesOfGoods = new ArrayList<>();
        //List<GoodsAndCategoryId> goodsAndCategoryIds = new ArrayList<>();//存储商品的分类信息
        /*--------------------------------上上---------------------------------------*/
        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansAll = null;
        Long countAll = null;
        List<Category> categoriesOfGoodsAll = new ArrayList<>();
        List<GoodsAndCategoryId> goodsAndCategoryIdsAll = new ArrayList<>();//存储商品的分类信息
        /*--------------------------------上New下---------------------------------------*/

        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansIsNew = null;
        Long countIsNew = null;
        List<Category> categoriesOfGoodsIsNew = new ArrayList<>();
        //List<GoodsAndCategoryId> goodsAndCategoryIdsIsNew = new ArrayList<>();//存储商品的分类信息

        /*--------------------------------上New1下---------------------------------------*/

        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansIsNew1 = null;
        Long countIsNew1 = null;
        List<Category> categoriesOfGoodsIsNew1 = new ArrayList<>();
        List<GoodsAndCategoryId> goodsAndCategoryIdsIsNew1 = new ArrayList<>();//存储商品的分类信息

        /*--------------------------------上Hot下---------------------------------------*/
        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansIsHot = null;
        Long countIsHot = null;
        List<Category> categoriesOfGoodsIsHot = new ArrayList<>();
        //List<GoodsAndCategoryId> goodsAndCategoryIdsIsNew = new ArrayList<>();//存储商品的分类信息

        /*--------------------------------上Hot1下---------------------------------------*/

        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansIsHot1 = null;
        Long countIsHot1 = null;
        List<Category> categoriesOfGoodsIsHot1 = new ArrayList<>();
        List<GoodsAndCategoryId> goodsAndCategoryIdsIsHot1 = new ArrayList<>();//存储商品的分类信息

        /*--------------------------------上brand下---------------------------------------*/
        //根据bandID查找数据并返回一个goods,我任何还是根据类型去找Category
        List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansBand = null;
        Long countBand = null;
        List<Category> categoriesOfGoodsBand = new ArrayList<>();
        List<GoodsAndCategoryId> goodsAndCategoryIdsBand = new ArrayList<>();//存储商品的分类信息

        /*--------------------------------上下---------------------------------------*/
        if (wxGoodsAndSearchUseBO.getOrder() != null) {
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0) {
                /*都在就是搜索*/
                GoodsExample.Criteria criteria1 = goodsExample1.createCriteria();
                criteria1.andNameLike("%" + wxGoodsAndSearchUseBO.getKeyword() + "%");
                List<Goods> goodsList1 = goodsMapper.selectByExample(goodsExample1);
                goodsListBeans1 = new ArrayList<>();
                Integer categoryId1 = null;
                goodsAndCategoryIds.clear();
                for (Goods goods : goodsList1) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIds.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeans1.add(goodsListBean);
                }
                count1 = goodsMapper.countByExample(goodsExample1);
                //然后开始去重
                // List<GoodsAndCategoryId> goodsAndCategoryIds1 = (GoodsAndCategoryId)goodsAndCategoryIds.stream().distinct().collect(Collectors.toList()).forEach(System.out::println);

                for (int j = 0; j < goodsAndCategoryIds.size() - 1; j++) {
                    for (int k = goodsAndCategoryIds.size() - 1; k > j; k--) {
                        if (goodsAndCategoryIds.get(k).equals(goodsAndCategoryIds.get(j))) {
                            goodsAndCategoryIds.remove(k);
                        }
                    }
                }
                /*--------------------------------上下---------------------------------------*/
            } else if (wxGoodsAndSearchUseBO.getCategoryId() != 0) {
                /*搜索所有的类目*/
                GoodsExample.Criteria criteria1 = goodsExample2.createCriteria();
                criteria1.andNameLike("%" + wxGoodsAndSearchUseBO.getKeyword() + "%").andCategoryIdEqualTo(wxGoodsAndSearchUseBO.getCategoryId());
                List<Goods> goodsList1 = goodsMapper.selectByExample(goodsExample2);
                goodsListBeansAll = new ArrayList<>();
                Integer categoryId1 = null;

                for (Goods goods : goodsList1) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIdsAll.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeansAll.add(goodsListBean);
                }
                countAll = goodsMapper.countByExample(goodsExample1);
            }
            // List<GoodsAndCategoryId> goodsAndCategoryIds = new ArrayList<>();

            for (int j = 0; j < goodsAndCategoryIdsAll.size() - 1; j++) {
                for (int k = goodsAndCategoryIdsAll.size() - 1; k > j; k--) {
                    if (goodsAndCategoryIdsAll.get(k).equals(goodsAndCategoryIdsAll.get(j))) {
                        goodsAndCategoryIdsAll.remove(k);
                    }
                }
            }
            goodsAndCategoryIdsAll = goodsAndCategoryIds;
        }


        if (wxGoodsAndSearchUseBO.getIsNew()!=null) {
            //这个是第一次查询
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0) {
                GoodsExample.Criteria criteriaIsNew = goodsExampleIsNew.createCriteria();
                criteriaIsNew.andIsNewEqualTo(wxGoodsAndSearchUseBO.getIsNew());

                Integer categoryId1 = null;
                goodsListBeansIsNew = new ArrayList<>();
                List<Goods> goodsList = goodsMapper.selectByExample(goodsExampleIsNew);
                goodsAndCategoryIdsIsNew.clear();
                for (Goods goods : goodsList) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIdsIsNew.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeansIsNew.add(goodsListBean);
                }
                countIsNew = goodsMapper.countByExample(goodsExample1);

                for (int j = 0; j < goodsAndCategoryIdsIsNew.size() - 1; j++) {
                    for (int k = goodsAndCategoryIdsIsNew.size() - 1; k > j; k--) {
                        if (goodsAndCategoryIdsIsNew.get(k).equals(goodsAndCategoryIdsIsNew.get(j))) {
                            goodsAndCategoryIdsIsNew.remove(k);
                        }
                    }
                }
            } else if (wxGoodsAndSearchUseBO.getCategoryId() != 0) {
                GoodsExample.Criteria criteriaIsNew1 = goodsExampleIsNew1.createCriteria();
                criteriaIsNew1.andIsNewEqualTo(wxGoodsAndSearchUseBO.getIsNew()).andCategoryIdEqualTo(wxGoodsAndSearchUseBO.getCategoryId());

                //根据这个来获得ID
                Integer categoryId1 = null;
                goodsListBeansIsNew1 = new ArrayList<>();
                List<Goods> goodsList = goodsMapper.selectByExample(goodsExampleIsNew1);
                for (Goods goods : goodsList) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIdsIsNew1.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeansIsNew1.add(goodsListBean);
                }
                countIsNew1 = goodsMapper.countByExample(goodsExample1);
                for (int j = 0; j < goodsAndCategoryIdsIsNew1.size() - 1; j++) {
                    for (int k = goodsAndCategoryIdsIsNew1.size() - 1; k > j; k--) {
                        if (goodsAndCategoryIdsIsNew1.get(k).equals(goodsAndCategoryIdsIsNew1.get(j))) {
                            goodsAndCategoryIdsIsNew1.remove(k);
                        }
                    }
                }
                goodsAndCategoryIdsIsNew1 = goodsAndCategoryIdsIsNew;
            }
            //不等于null的时候就是有数据
        }

        //热品

        if (wxGoodsAndSearchUseBO.getIsHot()!=null) {
            //这个是第一次查询
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0) {
                GoodsExample.Criteria criteriaIsHot = goodsExampleIsHot.createCriteria();
                criteriaIsHot.andIsHotEqualTo(wxGoodsAndSearchUseBO.getIsHot());

                Integer categoryId1 = null;
                goodsListBeansIsHot = new ArrayList<>();
                List<Goods> goodsList = goodsMapper.selectByExample(goodsExampleIsHot);
                goodsAndCategoryIdsIsHot.clear();
                for (Goods goods : goodsList) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIdsIsHot.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeansIsHot.add(goodsListBean);
                }
                countIsHot = goodsMapper.countByExample(goodsExample1);

                for (int j = 0; j < goodsAndCategoryIdsIsHot.size() - 1; j++) {
                    for (int k = goodsAndCategoryIdsIsHot.size() - 1; k > j; k--) {
                        if (goodsAndCategoryIdsIsHot.get(k).equals(goodsAndCategoryIdsIsHot.get(j))) {
                            goodsAndCategoryIdsIsHot.remove(k);
                        }
                    }
                }
            } else if (wxGoodsAndSearchUseBO.getCategoryId() != 0) {
                GoodsExample.Criteria criteriaIsHot1 = goodsExampleIsHot1.createCriteria();
                criteriaIsHot1.andIsHotEqualTo(wxGoodsAndSearchUseBO.getIsHot()).andCategoryIdEqualTo(wxGoodsAndSearchUseBO.getCategoryId());

                //根据这个来获得ID
                Integer categoryId1 = null;
                goodsListBeansIsHot1 = new ArrayList<>();
                List<Goods> goodsList = goodsMapper.selectByExample(goodsExampleIsHot1);
                for (Goods goods : goodsList) {
                    categoryId1 = goods.getCategoryId();
                    GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                    goodsAndCategoryIdsIsHot1.add(goodsAndCategoryId);
                    WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                    goodsListBeansIsHot1.add(goodsListBean);
                }
                countIsHot1 = goodsMapper.countByExample(goodsExample1);
                for (int j = 0; j < goodsAndCategoryIdsIsHot1.size() - 1; j++) {
                    for (int k = goodsAndCategoryIdsIsHot1.size() - 1; k > j; k--) {
                        if (goodsAndCategoryIdsIsHot1.get(k).equals(goodsAndCategoryIdsIsHot1.get(j))) {
                            goodsAndCategoryIdsIsHot1.remove(k);
                        }
                    }
                }
                goodsAndCategoryIdsIsHot1 = goodsAndCategoryIdsIsHot;
            }
            //不等于null的时候就是有数据
        }
        if (wxGoodsAndSearchUseBO.getBrandId()!=null){
            GoodsExample.Criteria criteriaBrand = goodsExampleBrand.createCriteria();
            criteriaBrand.andBrandIdEqualTo(wxGoodsAndSearchUseBO.getBrandId());

            /* List<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeansBand = null;
        Long countBand = null;
        List<Category> categoriesOfGoodsBand = new ArrayList<>();
        List<GoodsAndCategoryId> goodsAndCategoryIdsBand = new ArrayList<>();//存储商品的分类信息*/
            //根据这个来获得ID
            Integer categoryId1 = null;
            goodsListBeansBand = new ArrayList<>();
            List<Goods> goodsList = goodsMapper.selectByExample(goodsExampleBrand);
            for (Goods goods : goodsList) {
                categoryId1 = goods.getCategoryId();
                GoodsAndCategoryId goodsAndCategoryId = new GoodsAndCategoryId(goods.getCategoryId());
                goodsAndCategoryIdsBand.add(goodsAndCategoryId);
                WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                goodsListBeansBand.add(goodsListBean);
            }
            countBand = goodsMapper.countByExample(goodsExample1);
        }

        //没有数据，怎么来的数据，根据goods数据找到的对应的
        /*--------------------------------下---------------------------------------*/
        GoodsExample goodsExample = new GoodsExample();
        GoodsExample.Criteria criteria = goodsExample.createCriteria();
        //后面才添加的list
        if (wxGoodsAndSearchUseBO.getCategoryId() !=null){
        criteria.andCategoryIdEqualTo(wxGoodsAndSearchUseBO.getCategoryId());
        }

        goodsExample.setOrderByClause(wxGoodsAndSearchUseBO.getSort() + " " + wxGoodsAndSearchUseBO.getOrder());

        //在这里，刘携带
        Long count = null;
        ArrayList<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeans = new ArrayList<>();
        if (wxGoodsAndSearchUseBO.getOrder() == null) {

            /*这里就根据categoryId查询到所有数据*/
            //List<Goods> goodsList = goodsMapper.selectByExample(goodsExample);
            List<Goods> goodsList = goodsMapper.selectByCategoryAll(wxGoodsAndSearchUseBO.getCategoryId());/*这个是分类表中的数据*/

            /*使用goodsListBeans来接受数据*/
            //ArrayList<WXGoodsShowListVO.DataBean.GoodsListBean> goodsListBeans = new ArrayList<>();
            Integer categoryId2 = null;
            for (Goods goods : goodsList) {
                categoryId2 = goods.getCategoryId();
                WXGoodsShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsShowListVO.DataBean.GoodsListBean(goods.getId(), goods.getName(), goods.getBrief(), goods.getPicUrl(), goods.getIsNew(), goods.getIsHot(), goods.getCounterPrice(), goods.getRetailPrice());
                goodsListBeans.add(goodsListBean);
            }
            count = goodsMapper.countByExample(goodsExample);
        }


        /*-----就是根据ID 查询Category中的pid,根据pid所有的数据----*/
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeans1 = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansAll = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansIsNew = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansIsNew1 = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansIsHot = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansIsHot1 = new ArrayList<>();
        List<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeansBrand = new ArrayList<>();
        if (wxGoodsAndSearchUseBO.getOrder() != null) {
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){

            //categoriesOfGoods 这个放的是所有的pid
            ArrayList<Category> categories = new ArrayList<>();
            for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIds) {
                //这个就是所有的
                Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                categories.add(categoryIdOfGoods);
            }
            for (Category category : categories) {
                    WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                    filterCategoryListBeans1.add(filterCategoryListBean);
            }
        }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){
                //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
                //就是说，我需要在goods
                ArrayList<Category> categories = new ArrayList<>();
                for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsAll) {
                    //这个就是所有的
                    Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                    categories.add(categoryIdOfGoods);
                }
                for (Category category : categories) {
                    WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                    filterCategoryListBeansAll.add(filterCategoryListBean);
                }
            }
        }


        ArrayList<WXGoodsShowListVO.DataBean.FilterCategoryListBean> filterCategoryListBeans = new ArrayList<>();
        if (wxGoodsAndSearchUseBO.getOrder()==null) {
            List<Category> categoryList = categoryMapper.selectByAllUseCategoryId(wxGoodsAndSearchUseBO.getCategoryId());
            for (Category category : categoryList) {
                WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                filterCategoryListBeans.add(filterCategoryListBean);
            }
        }

        if (wxGoodsAndSearchUseBO.getIsNew()!=null){
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){
            //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
            //就是说，我需要在goods
            ArrayList<Category> categories = new ArrayList<>();
            for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsIsNew) {
                //这个就是所有的
                Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                categories.add(categoryIdOfGoods);
            }
            for (Category category : categories) {
                WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                filterCategoryListBeansIsNew.add(filterCategoryListBean);
            }
            }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){
                //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
                //就是说，我需要在goods
                ArrayList<Category> categories = new ArrayList<>();
                for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsIsNew1) {
                    //这个就是所有的
                    Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                    categories.add(categoryIdOfGoods);
                }
                for (Category category : categories) {
                    WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                    filterCategoryListBeansIsNew1.add(filterCategoryListBean);
                }
            }
        }

        if (wxGoodsAndSearchUseBO.getIsHot()!=null){
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){
                //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
                //就是说，我需要在goods
                ArrayList<Category> categories = new ArrayList<>();
                for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsIsHot) {
                    //这个就是所有的
                    Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                    categories.add(categoryIdOfGoods);
                }
                for (Category category : categories) {
                    WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                    filterCategoryListBeansIsHot.add(filterCategoryListBean);
                }
            }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){

                //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
                //就是说，我需要在goods
                ArrayList<Category> categories = new ArrayList<>();
                for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsIsHot1) {
                    //这个就是所有的
                    Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                    categories.add(categoryIdOfGoods);
                }
                for (Category category : categories) {
                    WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                    filterCategoryListBeansIsHot1.add(filterCategoryListBean);
                }
            }
        }

        if (wxGoodsAndSearchUseBO.getBrandId()!=null){
            //goodsAndCategoryIdsAll 这个放的是所有的pid   我们还是需要所有的PID
            //就是说，我需要在goods
            ArrayList<Category> categories = new ArrayList<>();
            for (GoodsAndCategoryId goodsAndCategoryId : goodsAndCategoryIdsBand) {
                //这个就是所有的
                Category categoryIdOfGoods = categoryMapper.selectByCategoryIdOfGoods(goodsAndCategoryId.getCategoryId());
                categories.add(categoryIdOfGoods);
            }
            for (Category category : categories) {
                WXGoodsShowListVO.DataBean.FilterCategoryListBean filterCategoryListBean = new WXGoodsShowListVO.DataBean.FilterCategoryListBean(category.getId(), category.getName(), category.getKeywords(), category.getDesc(), category.getPid(), category.getIconUrl(), category.getPicUrl(), category.getLevel(), category.getSortOrder(), category.getAddTime(), category.getUpdateTime(), category.getDeleted());
                filterCategoryListBeansBrand.add(filterCategoryListBean);
            }
        }

        WXGoodsShowListVO.DataBean dataBean =null;
        //dataBean = new WXGoodsShowListVO.DataBean(count,goodsListBeans,filterCategoryListBeans);
        if (wxGoodsAndSearchUseBO.getOrder()==null){
            //分类
            dataBean = new WXGoodsShowListVO.DataBean(count,goodsListBeans,filterCategoryListBeans);
        }else if (wxGoodsAndSearchUseBO.getOrder()!=null){
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){
                //搜索,分类的时候
                dataBean = new WXGoodsShowListVO.DataBean(count1,goodsListBeans1,filterCategoryListBeans1);
            }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){
                dataBean = new WXGoodsShowListVO.DataBean(countAll,goodsListBeansAll,filterCategoryListBeansAll);
            }
        }
        if (wxGoodsAndSearchUseBO.getIsNew()!=null){
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){
            dataBean = new WXGoodsShowListVO.DataBean(countIsNew,goodsListBeansIsNew,filterCategoryListBeansIsNew);
            }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){
                dataBean = new WXGoodsShowListVO.DataBean(countIsNew1,goodsListBeansIsNew1,filterCategoryListBeansIsNew1);
            }
        }
        if (wxGoodsAndSearchUseBO.getIsHot()!=null){
            if (wxGoodsAndSearchUseBO.getCategoryId() == 0){
                dataBean = new WXGoodsShowListVO.DataBean(countIsHot,goodsListBeansIsHot,filterCategoryListBeansIsHot);
            }else if (wxGoodsAndSearchUseBO.getCategoryId() != 0){
                dataBean = new WXGoodsShowListVO.DataBean(countIsHot1,goodsListBeansIsHot1,filterCategoryListBeansIsHot1);
            }
        }
        if (wxGoodsAndSearchUseBO.getBrandId()!=null){
            dataBean = new WXGoodsShowListVO.DataBean(countBand,goodsListBeansBand,filterCategoryListBeansBrand);
        }

        WXGoodsShowListVO wxGoodsShowListVO = new WXGoodsShowListVO(0,dataBean,"成功");

        return wxGoodsShowListVO;
    }

    @Override
    public synchronized WXIndexGoodsCountVO.DataBean wxIndexGoodsCount() {
        GoodsExample goodsExample = new GoodsExample();
        Long code = goodsMapper.countByExample(goodsExample);
        WXIndexGoodsCountVO.DataBean dataBean = new WXIndexGoodsCountVO.DataBean(code);
        return dataBean;
    }

    @Override
    public  WXGoodsCategoryShowList wxGoodsCategoryShow(Integer id1) {

        /*我这里要将主键ID查出来*/
        //直接根据ID去找，如果是主键l1，则pid = 0,如果是一大串数字，则pid为真正的主键ID
        Category code = categoryMapper.selectByIdSearchPId(id1);
        Integer id = null;
        if (code.getPid() == 0){
            /*是L1类名*/
            id = id1;
        }else{
            /*是l2类名，code.getPid()为真正的类名*/
            id = code.getPid();
        }

        /*这个就是展示*/
        /*通过父ID（id）找子ID（list）*/
        CategoryExample categoryExample = new CategoryExample();
        CategoryExample.Criteria criteria = categoryExample.createCriteria();
        criteria.andPidEqualTo(id);
        /*先找到当前类*/


        /*WXGoodsCategoryShowList.DataBean.CurrentCategoryBean currentCategoryBean = null;
        for (Category category : categoryList) {
            currentCategoryBean = new WXGoodsCategoryShowList.DataBean.CurrentCategoryBean(category.getId(),category.getName(),category.getKeywords(),category.getDesc(),category.getPid(),category.getIconUrl(),category.getPicUrl(),category.getLevel(),category.getSortOrder(),category.getAddTime(),category.getUpdateTime(),category.getDeleted());
        }*/

        /*第二，找到父类ID,这个就是pid*/
        Category category = categoryMapper.selectByPrimaryKey(id);
       if ("L1".equals(category.getLevel())){
           i =1;
       }
        WXGoodsCategoryShowList.DataBean.ParentCategoryBean parentCategoryBean = new WXGoodsCategoryShowList.DataBean.ParentCategoryBean(category.getId(),category.getName(),category.getKeywords(),category.getDesc(),category.getPid(),category.getIconUrl(),category.getPicUrl(),category.getLevel(),category.getSortOrder(),category.getAddTime(),category.getUpdateTime(),category.getDeleted());

        /*第三找到兄弟类ID,兄弟类ID就是上面的商标，兄弟ID不能变，兄弟ID就是上面的商标,新的问题，如果有新的ID进来，他不会变，错误原因就是每一次更换ID，有些商品能变，有些商品不能变*/
        /*if (id!=staticId){
            i = 1;
            staticId = id;
        }*/
        /*显示袜子，这里还是锅，就是这里还没有找*/
        if (i ==1){
            categoryList = categoryMapper.selectByExample(categoryExample);
            i--;
        }
        /*如果袜子的pid,不等于锅具的pid就重新查,现在这个id就是父ID，找他的父ID*/
        /*if (category.getPid() != categoryList.get(0).getPid()){
            categoryList = categoryMapper.selectByExample(categoryExample);
        }*/
        ArrayList<WXGoodsCategoryShowList.DataBean.BrotherCategoryBean> brotherCategoryBeans = new ArrayList<>();
        for (Category category1 : categoryList) {
            WXGoodsCategoryShowList.DataBean.BrotherCategoryBean brotherCategoryBean = new WXGoodsCategoryShowList.DataBean.BrotherCategoryBean(category1.getId(),category1.getName(),category1.getKeywords(),category1.getDesc(),category1.getPid(),category1.getIconUrl(),category1.getPicUrl(),category1.getLevel(),category1.getSortOrder(),category1.getAddTime(),category1.getUpdateTime(),category1.getDeleted());
            brotherCategoryBeans.add(brotherCategoryBean);
        }

        WXGoodsCategoryShowList.DataBean.CurrentCategoryBean currentCategoryBean = null;
        /*if (categoryList.size()!=0){
            currentCategoryBean =new WXGoodsCategoryShowList.DataBean.CurrentCategoryBean(categoryList.get(0).getId(),categoryList.get(0).getName(),categoryList.get(0).getKeywords(),categoryList.get(0).getDesc(),categoryList.get(0).getPid(),categoryList.get(0).getIconUrl(),categoryList.get(0).getPicUrl(),categoryList.get(0).getLevel(),categoryList.get(0).getSortOrder(),categoryList.get(0).getAddTime(),categoryList.get(0).getUpdateTime(),categoryList.get(0).getDeleted());
        }else if (categoryList.size()==0){
            /*如果当前等于0，就说明移动到第二个了，直接把get(0),变为2*/
            int flag = 0;
            for (int i = 0; i < categoryList.size(); i++) {
                if (id1.equals(categoryList.get(i).getId())){
                    flag = i;
                }
            }
            currentCategoryBean =new WXGoodsCategoryShowList.DataBean.CurrentCategoryBean(categoryList.get(flag).getId(),categoryList.get(flag).getName(),categoryList.get(flag).getKeywords(),categoryList.get(flag).getDesc(),categoryList.get(flag).getPid(),categoryList.get(flag).getIconUrl(),categoryList.get(flag).getPicUrl(),categoryList.get(flag).getLevel(),categoryList.get(flag).getSortOrder(),categoryList.get(flag).getAddTime(),categoryList.get(flag).getUpdateTime(),categoryList.get(flag).getDeleted());
            //currentCategoryBean =new WXGoodsCategoryShowList.DataBean.CurrentCategoryBean(category.getId(),category.getName(),category.getKeywords(),category.getDesc(),category.getPid(),category.getIconUrl(),category.getPicUrl(),category.getLevel(),category.getSortOrder(),category.getAddTime(),category.getUpdateTime(),category.getDeleted());
       // }

        WXGoodsCategoryShowList.DataBean dataBean = new WXGoodsCategoryShowList.DataBean(currentCategoryBean,parentCategoryBean,brotherCategoryBeans);
        WXGoodsCategoryShowList wxGoodsCategoryShowList = new WXGoodsCategoryShowList(0,dataBean,"成功");
        return wxGoodsCategoryShowList;
    }

    @Override
    public  WXGoodsRealtedShowListVO wxGoodsRelatedShow(Integer id) {
        /*这个id就是商品ID*/

         ArrayList<WXGoodsRealtedShowListVO.DataBean.GoodsListBean> goodsListBeans = new ArrayList<>();

        /*根据商品ID找category_ID,genjcategoryId再找剩下4个商品*/
        List<Goods> goodsList = goodsMapper.selectByCategoryIdAndSearchOthersGoods(id);
        for (Goods goods : goodsList) {
            WXGoodsRealtedShowListVO.DataBean.GoodsListBean goodsListBean = new WXGoodsRealtedShowListVO.DataBean.GoodsListBean(goods.getId(),goods.getName(),goods.getBrief(),goods.getPicUrl(),goods.getIsNew(),goods.getIsHot(),goods.getCounterPrice(),goods.getRetailPrice());
            goodsListBeans.add(goodsListBean);
        }

        WXGoodsRealtedShowListVO.DataBean dataBean = new WXGoodsRealtedShowListVO.DataBean(goodsListBeans);
        WXGoodsRealtedShowListVO wxGoodsRealtedShowListVO = new WXGoodsRealtedShowListVO(0,dataBean,"成功");
        return wxGoodsRealtedShowListVO;
    }

    @Override
    public synchronized WXGoodsDetailShowListVO.DataBeanX wxGoodsDetailList(Integer id) {
        /*这个id是goodsid*/
        /*----------------------------specificationList(上)----------------------------*/
        GoodsSpecificationExample goodsSpecificationExample = new GoodsSpecificationExample();
        GoodsSpecificationExample.Criteria criteria = goodsSpecificationExample.createCriteria();


        ArrayList<WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean> specificationListBeans = new ArrayList<>();
        /*应该是先查数据库表，根据goodsID查规格,这是返回规则的种类，有几个规则*/
        List<WXSearchSpecificationOfGoodsSpecificationBO> wxSearchSpecificationOfGoodsSpecificationBOS = goodsSpecificationMapper.searchSpecificationOfGoodsSpecification(id);
        for (WXSearchSpecificationOfGoodsSpecificationBO wxSearchSpecificationOfGoodsSpecificationBO : wxSearchSpecificationOfGoodsSpecificationBOS) {
            /*然后根据规格和goodsid查询到数据*/
            criteria.andGoodsIdEqualTo(id).andSpecificationEqualTo(wxSearchSpecificationOfGoodsSpecificationBO.getSpecification());
            List<WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean.ValueListBean> valueListBeans = new ArrayList<>();
            List<GoodsSpecification> goodsSpecificationList = goodsSpecificationMapper.selectByExample(goodsSpecificationExample);
            for (GoodsSpecification goodsSpecification : goodsSpecificationList) {
                WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean.ValueListBean valueListBean = new WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean.ValueListBean(goodsSpecification.getId(),goodsSpecification.getGoodsId(),goodsSpecification.getSpecification(),goodsSpecification.getValue(),goodsSpecification.getPicUrl(),goodsSpecification.getAddTime(),goodsSpecification.getUpdateTime(),goodsSpecification.getDeleted());
                valueListBeans.add(valueListBean);
            }

            WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean specificationListBean = new WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean(wxSearchSpecificationOfGoodsSpecificationBO.getSpecification(),valueListBeans);
            specificationListBeans.add(specificationListBean);
        }

        //WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean specificationListBean1 = new WXGoodsDetailShowListVO.DataBeanX.SpecificationListBean();
        //specificationListBeans
        /*----------------------------specificationList(下)----------------------------*/

        //这一个写"groupon"
        /*-------------------------------groupon(上)-------------------------------*/
        ArrayList<Object> groupon = new ArrayList<>();
        /*-------------------------------groupon(下)-------------------------------*/

        //这一个写"issue"
        /*-------------------------------issue(上)-------------------------------*/
        IssueExample issueExample = new IssueExample();
        IssueExample.Criteria criteria1 = issueExample.createCriteria();

        List<Issue> issues = issueMapper.selectByExample(issueExample);
        ArrayList<WXGoodsDetailShowListVO.DataBeanX.IssueBean> issueBeans = new ArrayList<>();
        for (Issue issue : issues) {
            /*这里的日期是string ，不是date*/
            WXGoodsDetailShowListVO.DataBeanX.IssueBean issueBean = new WXGoodsDetailShowListVO.DataBeanX.IssueBean(issue.getId(),issue.getQuestion(),issue.getAnswer(),issue.getAddTime(),issue.getUpdateTime(),issue.getDeleted());
            issueBeans.add(issueBean);
        }
        //issueBeans
        /*-------------------------------issue(下)-------------------------------*/

        //userHasCollect  这个不知道是上面
        /*-------------------------------userHasCollect(上)-------------------------------*/
        Integer userHasCollect = 0;
         /*直接赋值为0*/
        /*-------------------------------userHasCollect(下)-------------------------------*/

        //shareImage 也是个空字符串 ""
        /*-------------------------------shareImage(上)-------------------------------*/
        String shareImage = "";
        /*-------------------------------shareImage(下)-------------------------------*/

        //"comment"
        /*-------------------------------comment(上)-------------------------------*/
        CommentExample commentExample = new CommentExample();
        CommentExample.Criteria criteria2 = commentExample.createCriteria();
        commentExample.setOrderByClause("add_time"+" "+"desc");
        criteria2.andValueIdEqualTo(id);

         List<WXGoodsDetailShowListVO.DataBeanX.CommentBean.DataBean> dataBeans = new ArrayList<>();
        List<Comment> comments = commentMapper.selectByExample(commentExample);
        for (Comment comment : comments) {
            /*连接查询，连接comment与user表*/
            WXSelectByUserIdAndNickNameBO wxSelectByUserIdAndNickNameBO = userMapper.selectByUserIdAndNickName(comment.getUserId());
            DateToStringUtil dateToStringUtil = new DateToStringUtil();
            String dateToStringUtilOfCommentDate = dateToStringUtil.dateToString(comment.getAddTime());
            WXGoodsDetailShowListVO.DataBeanX.CommentBean.DataBean dataBean = new WXGoodsDetailShowListVO.DataBeanX.CommentBean.DataBean(dateToStringUtilOfCommentDate,wxSelectByUserIdAndNickNameBO.getNickname(),comment.getId(),wxSelectByUserIdAndNickNameBO.getAvatar(),comment.getContent(),comment.getPicUrls());
            dataBeans.add(dataBean);
        }
        Long code = commentMapper.countByExample(commentExample);
        WXGoodsDetailShowListVO.DataBeanX.CommentBean commentBean = new WXGoodsDetailShowListVO.DataBeanX.CommentBean(code,dataBeans);

        //commentBean
        /*-------------------------------comment(下)-------------------------------*/

        //"attribute"
        /*-------------------------------attribute(上)-------------------------------*/
        GoodsAttributeExample goodsAttributeExample = new GoodsAttributeExample();
        GoodsAttributeExample.Criteria criteria3 = goodsAttributeExample.createCriteria();
        criteria3.andGoodsIdEqualTo(id);

        List<GoodsAttribute> goodsAttributes = goodsAttributeMapper.selectByExample(goodsAttributeExample);
        List<WXGoodsDetailShowListVO.DataBeanX.AttributeBean> attributeBeans = new ArrayList<>();
        for (GoodsAttribute goodsAttribute : goodsAttributes) {
            WXGoodsDetailShowListVO.DataBeanX.AttributeBean attributeBean = new WXGoodsDetailShowListVO.DataBeanX.AttributeBean(goodsAttribute.getId(),goodsAttribute.getGoodsId(),goodsAttribute.getAttribute(),goodsAttribute.getValue(),goodsAttribute.getAddTime(),goodsAttribute.getUpdateTime(),goodsAttribute.getDeleted());
            attributeBeans.add(attributeBean);
        }
        //attributeBeans
        /*-------------------------------attribute(下)-------------------------------*/

        /*brand就是通过商品id来找到brandid -》找到brand信息*/
        /*-------------------------------brand(上)-------------------------------*/
        Brand brand = brandMapper.selectByIdJoinBrandAndGoods(id);
        WXGoodsDetailShowListVO.DataBeanX.BrandBean brandBean = null;
        if (brand!=null){
            brandBean = new WXGoodsDetailShowListVO.DataBeanX.BrandBean(brand.getId(),brand.getName(),brand.getDesc(),brand.getPicUrl(),brand.getSortOrder(),brand.getFloorPrice(),brand.getAddTime(),brand.getUpdateTime(),brand.getDeleted());
        }
        //brandBean
        /*-------------------------------brand(下)-------------------------------*/

        //productList
        /*-------------------------------productList(上)-------------------------------*/
        GoodsProductExample goodsProductExample1 = new GoodsProductExample();
        GoodsProductExample.Criteria criteria4 = goodsProductExample1.createCriteria();
        criteria4.andGoodsIdEqualTo(id);
        List<GoodsProduct> goodsProductList = goodsProductMapper.selectByExample(goodsProductExample1);
        ArrayList<WXGoodsDetailShowListVO.DataBeanX.ProductListBean> productListBeans = new ArrayList<>();
        for (GoodsProduct goodsProduct : goodsProductList) {
            //数据没有传进去
            WXGoodsDetailShowListVO.DataBeanX.ProductListBean productListBean = new WXGoodsDetailShowListVO.DataBeanX.ProductListBean(goodsProduct.getId(),goodsProduct.getGoodsId(),goodsProduct.getPrice(),goodsProduct.getNumber(),goodsProduct.getUrl(),goodsProduct.getAddTime(),goodsProduct.getUpdateTime(),goodsProduct.getDeleted(),goodsProduct.getSpecifications());
            productListBeans.add(productListBean);
        }
        //productListBeans
        /*-------------------------------productList(下)-------------------------------*/

        //info
        /*-------------------------------productList(下)-------------------------------*/
        Goods goods = goodsMapper.selectByPrimaryKey(id);
        //
        WXGoodsDetailShowListVO.DataBeanX.InfoBean infoBean = new WXGoodsDetailShowListVO.DataBeanX.InfoBean(goods.getId(),goods.getGoodsSn(),goods.getName(),goods.getCategoryId(),goods.getBrandId(),goods.getKeywords(),goods.getBrief(),goods.getIsOnSale(),goods.getSortOrder(),goods.getPicUrl(),goods.getShareUrl(),goods.getIsNew(),goods.getIsHot(),goods.getUnit(),goods.getCounterPrice(),goods.getRetailPrice(),goods.getAddTime(),goods.getUpdateTime(),goods.getDeleted(),goods.getDetail(),goods.getGallery());
        /*-------------------------------productList(下)-------------------------------*/

        WXGoodsDetailShowListVO.DataBeanX dataBeanX = new WXGoodsDetailShowListVO.DataBeanX(userHasCollect,shareImage,commentBean,brandBean,infoBean,specificationListBeans,groupon,issueBeans,attributeBeans,productListBeans);


        return dataBeanX;
    }
}
